from loguru import logger
import subprocess
def python_call_powershell(username:str,password:str):
    try:
        args=[r"powershell",'./auoLogin.ps1',username,password] #args参数里的ip是对应调用powershell里的动态参数args[0],类似python中的sys.argv[1]
        p=subprocess.Popen(args, stdout=subprocess.PIPE)
        dt=p.stdout.read()
        return dt.decode('utf-8')  
        # return eval(str(dt, encoding = "utf-8"))
    except Exception as e:
        print (e)
        return False


if __name__=="__main__":
    res = python_call_powershell("xiaosongzhuo",'auosong2030..')
    logger.debug(res.split('RawContent')[0])